var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

router.get('/ajaxdemo',async function(req,res){
  await sleep(3000);
  res.send('ok');
})

function sleep(wait){
  return new Promise(resolve=>{
    setTimeout(resolve,wait)
  })
}

module.exports = router;
